{extend name="base"/}
{block name="main"}
<div class="Hui-article">
    <article class="cl pd-20">
        <div class="n_tab_line">
            <a href="{:url('bargain/bargain_order')}" class="n_tab_list">活动订单</a>
            <div class="cl"></div>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <form class="Huiform" method="post" action="__CONF_SITE__admin/bargain/bargain_order" target="_self">
                <div class="text-c"> 活动名称：
                    <input type="text" class="input-text" value="{$search_text}" style="width:250px" placeholder="输入活动名称"  name="search_text">
                    <button type="submit" class="btn btn-search radius"  name=""><i class="Hui-iconfont">&#xe665;</i> 搜活动</button>
                </div>
            </form>
        </div>
        <div id="tab_demo" class="HuiTab" style="margin-top: 15px;">
            <div class="tabBar clearfix">
                <a href="/admin/order/bargain_order?status=-2"><span {if condition="$status==-2"} class="current" {/if}>全部</span></a>
                <a href="/admin/order/bargain_order?status=0"><span {if condition="$status==0"} class="current" {/if}>待支付</span></a>
                <a href="/admin/order/bargain_order?status=1"><span {if condition="$status==1"} class="current" {/if}>支付成功</span></a>
                <a href="/admin/order/bargain_order?status=3"><span {if condition="$status==3"} class="current" {/if}>已完成</span></a>
                <a href="/admin/order/bargain_order?status=-1"><span {if condition="$status==-1"} class="current" {/if}>取消订单</span></a>
            </div>
        </div>
        <table class="table table-border table-bordered table-hover table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="11">活动订单</th>
            </tr>
            <tr class="text-c">
                <th>订单编号</th>
                <th>活动名称</th>
                <th>活动主图</th>
                <th>发起用户</th>
                <th>真实姓名</th>
                <th>手机号</th>
                <th>用户地址</th>
                <th>发起金额</th>
                <th>支付金额</th>
                <th>订单状态</th>
            </tr>
            </thead>
            <tbody>
            {volist name="list" id="vo"}
            <tr>
                <td>{$vo['order_no']}</td>
                <td>{$vo['bargain_name']}</td>
                <td><img src="/{$vo['img_cover_small']}" width="120px"></td>
                <td>{$vo['user_name']}</td>
                <td>{$vo['receiver_name']}</td>
                <td>{$vo['receiver_mobile']}</td>
                <td>{:getCity($vo['receiver_area'])}</td>
                <td>￥{$vo['original_price']}</td>
                <td>￥{$vo['order_money']}</td>
                <td>{:bargain_order_status($vo['order_status'])}</td>
            </tr>
            {/volist}
            </tbody>
        </table>
    </article>
    <div class="n_page_no">
        {$page}
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */
    /*活动-状态*/
    function bargain_status(id,key){
        var msg='';
        if(key=='off'){
            msg='确定要下架吗？';
        }else {
            msg='确定要上架吗？';
        }
        layer.confirm(msg,function(){
            //此处请求后台程序
            //后台处理
            $.ajax({
                type : "post",
                url : "{:url('bargain/bargain_status')}",
                data : {
                    "id" : id,
                    "key":key
                },
                success : function(data) {
                    if (data['code'] > 0) {
                        layer.msg('操作成功',{icon:1,time:1000},function () {
                            window.location.reload();
                        });
                    }else{
                        layer.msg(data['message'], {icon: 2, time: 1000});
                    }
                }
            })
        });
    }
    /*活动-编辑*/
    function bargain_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }
</script>
{/block}